package Demo1;

public class Demo1 {
    public static void main(String[] args) {
        Thread thread= new Thread(() -> {
           while(true) {
               System.out.println("hello thread");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });

        //启动两次线程,会报错，只能启动一次
        thread.start();
        thread.start();

        System.out.println("hello main");
    }
}
